Skip to content

Comments

alternationのキャプチャグループバグを修正し specs を追加#32

Merged
vvakame merged 2 commits intomasterfrom
fix/capture-group-bugs
Feb 21, 2026
Merged

alternationのキャプチャグループバグを修正し specs を追加#32
vvakame merged 2 commits intomasterfrom
fix/capture-group-bugs

Conversation

@vvakame
Copy link
Contributor

@vvakame vvakame commented Feb 21, 2026

Summary

#24 のフォローアップです。

修正内容

各パターンを非キャプチャグループ (?:...) に書き換え、キャプチャグループを1つに統合:

# Before: 2番目以降の選択肢で $1 が空になる
- pattern: /埋めこ([まむめもん])|うめこ([まむめもん])/
  expected: 埋め込$1

# After: キャプチャグループが1つなので常に $1 に入る
- pattern: /(?:埋めこ|うめこ)([まむめもん])/
  expected: 埋め込$1

Test plan

  • npm test が通ること
  • 修正前のパターンで specs が失敗することを確認済み

🤖 Generated with Claude Code

vvakame and others added 2 commits February 21, 2026 12:27
おこなう/行なう の送り仮名保持を検証するテストケースを追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR #24 で指摘されていた、alternation(|)の各選択肢に個別のキャプチャグループが
あるパターンを非キャプチャグループ (?:...) に書き換え、送り仮名の消失を防止。
対象19パターンすべてに specs を追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vvakame vvakame merged commit d7b19f7 into master Feb 21, 2026
1 check passed
@vvakame vvakame deleted the fix/capture-group-bugs branch February 21, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant